This report describes the process behind the creation of a Machine Learning Model used to classify weight lifting exercise (Unilateral Dumbbell Biceps Curling) in classes:
. A: exactly according to the specification; . B: throwing the elbows to the front; . C: lifting the dumbbell only halfway; . D: lowering the dumbbell only halfway; . E: throwing the hips to the front (Class E).
More about the research and data used can be found on the following website: http://groupware.les.inf.puc-rio.br/har#weight_lifting_exercises#ixzz6CzLP0YxO
TODO: resultado do modelo
Our data source urls:
TRAINING_SOURCE_FILE_URL <- "https://d396qusza40orc.cloudfront.net/predmachlearn/pml-training.csv"
TESTING_SOURCE_FILE_URL <- "https://d396qusza40orc.cloudfront.net/predmachlearn/pml-testing.csv"
Loading and splitting the data (training, validating and testing):
NA_STRINGS <- c("NA","#DIV/0!")
training <- read.csv(TRAINING_FILE_PATH, na.strings = NA_STRINGS)
testing <- read.csv(TESTING_FILE_PATH, na.strings = NA_STRINGS)
in.training <- createDataPartition(y = training$class, p = 0.7, list = FALSE)
validating <- training[-in.training, ]
training <- training[in.training, ]
How our training dataset looks like:
Rows for each “classe”:
Columns with high NA counts.
Outliers.
Remove unecessary columns
NZV
Outlier removal.
Normalization?
Models
Boxplot for each numeric variable per classe:
## [1] "roll_belt"
## [1] "pitch_belt"
## [1] "yaw_belt"
## [1] "total_accel_belt"
## [1] "kurtosis_roll_belt"
## [1] "kurtosis_picth_belt"
## [1] "skewness_roll_belt"
## [1] "skewness_roll_belt.1"
## [1] "max_roll_belt"
## [1] "max_picth_belt"
## [1] "max_yaw_belt"
## [1] "min_roll_belt"
## [1] "min_pitch_belt"
## [1] "min_yaw_belt"
## [1] "amplitude_roll_belt"
## [1] "amplitude_pitch_belt"
## [1] "amplitude_yaw_belt"
## [1] "var_total_accel_belt"
## [1] "avg_roll_belt"
## [1] "stddev_roll_belt"
## [1] "var_roll_belt"
## [1] "avg_pitch_belt"
## [1] "stddev_pitch_belt"
## [1] "var_pitch_belt"
## [1] "avg_yaw_belt"
## [1] "stddev_yaw_belt"
## [1] "var_yaw_belt"
## [1] "gyros_belt_x"
## [1] "gyros_belt_y"
## [1] "gyros_belt_z"
## [1] "accel_belt_x"
## [1] "accel_belt_y"
## [1] "accel_belt_z"
## [1] "magnet_belt_x"
## [1] "magnet_belt_y"
## [1] "magnet_belt_z"
## [1] "roll_arm"
## [1] "pitch_arm"
## [1] "yaw_arm"
## [1] "total_accel_arm"
## [1] "var_accel_arm"
## [1] "avg_roll_arm"
## [1] "stddev_roll_arm"
## [1] "var_roll_arm"
## [1] "avg_pitch_arm"
## [1] "stddev_pitch_arm"
## [1] "var_pitch_arm"
## [1] "avg_yaw_arm"
## [1] "stddev_yaw_arm"
## [1] "var_yaw_arm"
## [1] "gyros_arm_x"
## [1] "gyros_arm_y"
## [1] "gyros_arm_z"
## [1] "accel_arm_x"
## [1] "accel_arm_y"
## [1] "accel_arm_z"
## [1] "magnet_arm_x"
## [1] "magnet_arm_y"
## [1] "magnet_arm_z"
## [1] "kurtosis_roll_arm"
## [1] "kurtosis_picth_arm"
## [1] "kurtosis_yaw_arm"
## [1] "skewness_roll_arm"
## [1] "skewness_pitch_arm"
## [1] "skewness_yaw_arm"
## [1] "max_roll_arm"
## [1] "max_picth_arm"
## [1] "max_yaw_arm"
## [1] "min_roll_arm"
## [1] "min_pitch_arm"
## [1] "min_yaw_arm"
## [1] "amplitude_roll_arm"
## [1] "amplitude_pitch_arm"
## [1] "amplitude_yaw_arm"
## [1] "roll_dumbbell"
## [1] "pitch_dumbbell"
## [1] "yaw_dumbbell"
## [1] "kurtosis_roll_dumbbell"
## [1] "kurtosis_picth_dumbbell"
## [1] "skewness_roll_dumbbell"
## [1] "skewness_pitch_dumbbell"
## [1] "max_roll_dumbbell"
## [1] "max_picth_dumbbell"
## [1] "max_yaw_dumbbell"
## [1] "min_roll_dumbbell"
## [1] "min_pitch_dumbbell"
## [1] "min_yaw_dumbbell"
## [1] "amplitude_roll_dumbbell"
## [1] "amplitude_pitch_dumbbell"
## [1] "amplitude_yaw_dumbbell"
## [1] "total_accel_dumbbell"
## [1] "var_accel_dumbbell"
## [1] "avg_roll_dumbbell"
## [1] "stddev_roll_dumbbell"
## [1] "var_roll_dumbbell"
## [1] "avg_pitch_dumbbell"
## [1] "stddev_pitch_dumbbell"
## [1] "var_pitch_dumbbell"
## [1] "avg_yaw_dumbbell"
## [1] "stddev_yaw_dumbbell"
## [1] "var_yaw_dumbbell"
## [1] "gyros_dumbbell_x"
## [1] "gyros_dumbbell_y"
## [1] "gyros_dumbbell_z"
## [1] "accel_dumbbell_x"
## [1] "accel_dumbbell_y"
## [1] "accel_dumbbell_z"
## [1] "magnet_dumbbell_x"
## [1] "magnet_dumbbell_y"
## [1] "magnet_dumbbell_z"
## [1] "roll_forearm"
## [1] "pitch_forearm"
## [1] "yaw_forearm"
## [1] "kurtosis_roll_forearm"
## [1] "kurtosis_picth_forearm"
## [1] "skewness_roll_forearm"
## [1] "skewness_pitch_forearm"
## [1] "max_roll_forearm"
## [1] "max_picth_forearm"
## [1] "max_yaw_forearm"
## [1] "min_roll_forearm"
## [1] "min_pitch_forearm"
## [1] "min_yaw_forearm"
## [1] "amplitude_roll_forearm"
## [1] "amplitude_pitch_forearm"
## [1] "amplitude_yaw_forearm"
## [1] "total_accel_forearm"
## [1] "var_accel_forearm"
## [1] "avg_roll_forearm"
## [1] "stddev_roll_forearm"
## [1] "var_roll_forearm"
## [1] "avg_pitch_forearm"
## [1] "stddev_pitch_forearm"
## [1] "var_pitch_forearm"
## [1] "avg_yaw_forearm"
## [1] "stddev_yaw_forearm"
## [1] "var_yaw_forearm"
## [1] "gyros_forearm_x"
## [1] "gyros_forearm_y"
## [1] "gyros_forearm_z"
## [1] "accel_forearm_x"
## [1] "accel_forearm_y"
## [1] "accel_forearm_z"
## [1] "magnet_forearm_x"
## [1] "magnet_forearm_y"
## [1] "magnet_forearm_z"